package ru.evga.inse.server.gwt.user.client.menu.admin;

import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.HasClickHandlers;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiHandler;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Widget;


/**
 * The outermost UI of the application.
 */
public class AdminView
    extends Composite
{
    interface Binder
        extends UiBinder<Widget, AdminView>
    {
    }

    public interface Presenter
    {
        void goToCity();

        void goToStreet();
    }
    private static final Binder BINDER = GWT.create(Binder.class);
    @UiField
    HasClickHandlers m_city;
    @UiField
    HasClickHandlers m_street;
    Presenter m_presenter;

    public AdminView()
    {
        initWidget(BINDER.createAndBindUi(this));
    }

    @UiHandler("m_city")
    void onCity(ClickEvent event)
    {
        m_presenter.goToCity();
    }

    @UiHandler("m_street")
    void onStreet(ClickEvent event)
    {
        m_presenter.goToStreet();
    }

    public void setPresenter(Presenter presenter)
    {
        m_presenter = presenter;
    }
}
